package graphics.screens;

import files.Files;
import graphics.BootColor;

import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Graphics;

import state.State;
import tool.KeyCode;
import tool.ScreenUtils;
import boot.Boot;

public class GenresSuggestionsScreen extends Canvas {

	private static final int Y_MENU_OFFSET = 10;
	private static final int X_MENU_OFFSET = 5;
	private Graphics g;

	protected void paint(Graphics someGraphics) {

		g = someGraphics;
		ScreenUtils.setBlackBackground(g);
		int height = g.getFont().getHeight();

		g.setColor(BootColor.WHITE);
		int line = 0;

		g.drawString("1 - Good", X_MENU_OFFSET, Y_MENU_OFFSET + height
				* (line++), Graphics.LEFT | Graphics.TOP);
		g.drawString("2 - Calme", X_MENU_OFFSET, Y_MENU_OFFSET + height
				* (line++), Graphics.LEFT | Graphics.TOP);
		g.drawString("3 - Energie", X_MENU_OFFSET, Y_MENU_OFFSET + height
				* (line++), Graphics.LEFT | Graphics.TOP);
		g.drawString("4 - Hip hop", X_MENU_OFFSET, Y_MENU_OFFSET + height
				* (line++), Graphics.LEFT | Graphics.TOP);
		if (Boot.state().equals(State.WICKED_KEY_PRESSED)) {
			g.drawString("5 - Poubelle", X_MENU_OFFSET, Y_MENU_OFFSET + height
					* (line++), Graphics.LEFT | Graphics.TOP);
		}
	}

	public void keyPressed(int keyCode) {
		if (keyCode == KeyCode.ONE) {
			SuggestScreen goodSuggest = new SuggestScreen(Files.BOOT_ROOT
					+ "/_Good.db", Files.BOOT_ROOT
					+ "/DBProperties/_Good.db.properties");
			Boot.setDisplay(goodSuggest);
		} else if (keyCode == KeyCode.TWO) {
			SuggestScreen goodSuggest = new SuggestScreen(Files.BOOT_ROOT
					+ "/_Calme.db", Files.BOOT_ROOT
					+ "/DBProperties/_Calme.db.properties");
			Boot.setDisplay(goodSuggest);
		} else if (keyCode == KeyCode.THREE) {
			SuggestScreen goodSuggest = new SuggestScreen(Files.BOOT_ROOT
					+ "/_Energie.db", Files.BOOT_ROOT
					+ "/DBProperties/_Energie.db.properties");
			Boot.setDisplay(goodSuggest);
		} else if (keyCode == KeyCode.FOUR) {
			SuggestScreen goodSuggest = new SuggestScreen(Files.BOOT_ROOT
					+ "/Hip Hop.db", Files.BOOT_ROOT
					+ "/DBProperties/Hip Hop.db.properties");
			Boot.setDisplay(goodSuggest);
		} else if (keyCode == KeyCode.FIVE) {
			if (Boot.state().equals(State.WICKED_KEY_PRESSED)) {
				SuggestScreen goodSuggest = new SuggestScreen(Files.BOOT_ROOT
						+ "/Poubelle.db", Files.BOOT_ROOT
						+ "/DBProperties/Poubelle.db.properties");
				Boot.setDisplay(goodSuggest);
			}
		}
	}
}
